<?php

class Controller_Admin_Faq_Create extends Controller_Admin_Abstract
{
	function execute($request)
	{

		$form = new Form_Admin_Faq_Create;

		if ($request -> isPost() && $form -> isValid($_POST))
		{
			$data = $form -> getValues();

			$item = Mongo_Document::factory('faq');

			$item -> _id = $data['_id'];
			$item -> question = $data['question'];
			$item -> answer = $data['answer'];
			
			$item->updated_at = time();

			$item -> save();

			Agilet::redirect('admin/faq', null, null);
		}

		$request -> response = View::render($data = array('form' => $form), $script = 'controller/admin/edit.tpl');
	}

}
